package com.vision.core.cl.mvp;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.vision.core.cl.AppPlace;
import com.vision.core.cl.ClientFactory;

/**
 * ActivityMapper associates each {@link Place} with its corresponding {@link Activity}.
 */
public class AppActivityMapper implements ActivityMapper {

	private ClientFactory clientFactory;

	public AppActivityMapper(ClientFactory clientFactory) {
		this.clientFactory = clientFactory;
	}

	@Override
	public Activity getActivity(Place place) {
		if (place instanceof AppPlace) {
			AppPlace aPlace = (AppPlace) place;
			return new AppActivity(aPlace, clientFactory);
		}
		
		return null;
	}

}
